package cc.lucien.aop;

import org.aspectj.lang.annotation.*;
import org.springframework.stereotype.Component;

//@Component
//@Aspect
public class LogAop {

    @Pointcut("execution ( * cc.lucien.service.*.*(..) )")
    public void pc(){}

    @After("execution(* cc.lucien.service.UserServiceImpl.login(..))")
    public void after(){
        System.out.println("------------login after------------------");
    }

    @Before("execution ( * cc.lucien.service.*.*(..) )")
    public void before(){
        System.out.println("------------login before------------------");
    }

    @AfterReturning(value = "pc()", returning = "value")
    public void afterReturning(Object value){
        System.out.println("------------afterReturning, value="+value+"------------------");
    }

    @AfterThrowing(value = "pc()" , throwing = "e")
    public void throwing(Exception e) {
        System.out.println("------------throwing, exception="+e+"------------------");
    }
}
